<template>
  <div class="login">
    <van-nav-bar title="京东登录注册" left-arrow @click-left="onclick" />

    <main>
      <LoginInput />
    </main>
  </div>
</template>

<script setup lang="ts">

import LoginInput from './components/LoginInput.vue'
import { useRoute, useRouter } from 'vue-router'

const router = useRouter()
const route = useRoute()


function onclick() {
  //获取 url 地址 redirect
  const redirect = route.query.redirect as string
  //是否有记录
  if (redirect) {

    if (redirect === '/content') {

      router.replace({ name: 'films' })
      return
    }
    router.replace(redirect)
  } else {
    router.back()
  }
}

defineOptions({
  name: 'login'
})
</script>

<style scoped>
main {
  padding: 20px;
}

.click-left-icon {
  position: absolute;
  width: 60px;
  height: 40px;
  z-index: 1;
  top: 52px;
  left: 50px;
}

.van-cell-group {
  background-color: #ffffff;
}
</style>
